package com.icode.service.impl.user;

import com.icode.core.model.user.Customer;
import com.icode.core.model.user.User;
import com.icode.dao.UserDao;
import com.icode.service.user.CustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * Created with IntelliJ IDEA.
 * User: ZhongGang
 * Date: 15-1-11
 * Time: 上午12:50
 */
@Transactional
@Service("customerService")
public class CustomerServiceImpl implements CustomerService {
    @Autowired
    private UserDao userDao;

    @Override
    public UserDetails loadUserByUsername(String userName) throws UsernameNotFoundException {
        Customer customerByUsername = userDao.findCustomerByUsername(userName);
        return customerByUsername;
    }
}
